package com.gxa.modules.sys.entity;


import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gxa.common.validator.group.AddGroup;
import com.gxa.common.validator.group.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@ApiModel("用户实体类")
@Data
@TableName("user")
public class User implements Serializable {

    @ApiModelProperty("用户id")
    private Integer id;

    @ApiModelProperty("账户")
    @NotBlank(message="账户不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String name;

    @ApiModelProperty("用户名")
    private String uname;

    @ApiModelProperty("密码")
    @NotBlank(message="密码不能为空", groups = AddGroup.class)
    private String pwd;

    @ApiModelProperty("盐值")
    private String salt;

    @ApiModelProperty("状态")
    private Integer state;

    @ApiModelProperty("电话号码")
    private String tel;

    @ApiModelProperty("注册时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @TableField("registration_time")
    private Date registrationTime;

    @ApiModelProperty("账户余额")
    private BigDecimal account;

    @ApiModelProperty("累计学习时长")
    @TableField("study_time")
    private Integer studyTime;

    @ApiModelProperty("可用兑换时长")
    @TableField("exchange_time")
    private Integer exchangeTime;

}
